package com.hfh.thread;

/**
 * @Author hfh
 * @Date 2022 09 15 20 49
 **/
public class Test4{
    public static void main(String[] args) throws InterruptedException {
        System.out.println(Thread.currentThread().getPriority());

        Thread t1 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i =1;i<100;i++){
                    try {
                        Thread.sleep(10);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println("这是线程一");
                }

            }
        });

        Thread t2 = new Thread(new Runnable() {
            @Override
            public void run() {
                for (int i =1;i<100;i++){
                    try {
                        Thread.sleep(10);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    System.out.println("这是线程2");

                }
            }
        });




        t1.start();
        t2.start();
        t1.join();


        for (int i =1;i<100;i++){
            try {
                Thread.sleep(10);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println("这是线程@");

        }

    }
}
